package  
{
	import flash.display.Sprite;
	import flash.utils.getTimer;
	
	/**
	 * ...
	 * @author hbb
	 */
	public class StringTest extends Sprite 
	{
		
		public function StringTest() 
		{
			const count:int = 10000;
			var str:String = StringData.data;
			
			var i:int;
			var timer:uint;
			var tmp:String;
			
			
			timer = getTimer();
			for (i = 0; i < count; ++i)
			{
				tmp = str.replace(/yt/g, '**');
			}
			trace('replace:', getTimer() - timer);
			
			timer = getTimer();
			for (i = 0; i < count; ++i)
			{
				tmp = str.split('yt').join('**');
			}
			trace('split>join:', getTimer() - timer);
		}
		
	}

}

class StringData
{
	internal static var data:String = <![CDATA[
      var yt = yt || {};
 
      yt.timing = yt.timing || {};
 
      yt.timing.tick = function(label, opt_time) {
        var timer = yt.timing['timer'] || {};
        if(opt_time) {
          timer[label] = opt_time;
        }
        else {
          timer[label] = new Date().getTime();
        }
        yt.timing['timer'] = timer;
      };
 
      yt.timing.info = function(label, value) {
        var info_args = yt.timing['info_args'] || {};
        info_args[label] = value;
        yt.timing['info_args'] = info_args;
      };
 
        yt.timing.wff = true;
 
          
          
        yt.timing.info('an', 'dclk,afv');
 
        yt.timing.tick('start');
 
        yt.timing.info('li','1');
      
      try {
        yt.timing['srt'] = window.gtbExternal && window.gtbExternal.pageT() ||
              window.external && window.external.pageT;
      } catch(e) {}
      if (window.chrome && window.chrome.csi) {
        yt.timing['srt'] = Math.floor(window.chrome.csi().pageT);
      }
      if (window.msPerformance && window.msPerformance.timing) {
        yt.timing['srt'] = window.msPerformance.timing.responseStart - window.msPerformance.timing.navigationStart;
      }
	]]>;
}